#pragma once
#include <windows.h>
#include "ImageSplitter.h"
#include "ProgramOptions.h"
#include "tstring.h"
#include "WordProxy.h"




typedef enum { pthtFile, pthtDirectory } PathType_t;
typedef enum { cpeUnableToResolvePath, cpeUnableToCreatePath, cpeWrongPathType, cpeAccessDenied } CheckPathError_t;

class ECheckPathError
{
	CheckPathError_t m_Context;
	tstring m_HelperString;
public:
	ECheckPathError(CheckPathError_t Context) : m_Context(Context){};
	ECheckPathError(CheckPathError_t Context, const tstring& HelperString) 
		: m_Context(Context), m_HelperString(HelperString) {};

	CheckPathError_t GetContext() const {return m_Context; };
	void GetHelpString(tstring& HelpString) const {HelpString = m_HelperString;};
};

class CBaseExport
{
protected:
	static bool CheckWriteAccessToFile(const tstring& Path);
	static void ResizeCompletion(const SIZE& OriginalSize, SIZE& NewSize);
	static void PieceSizeCompletion(const SIZE& OriginalSize, SIZE& PieceSize);
	static void PreparePathToUse(tstring& Path, PathType_t PathType);
	static void ProcessCheckPathError(const ECheckPathError& Error);
	static void CorrectExt(tstring& OutputPath, const CProgramOptions& Options);
public:
	static bool GetOutputPath(const CProgramOptions& Options, tstring& OutputPath);
	static bool LoadAndResizeImage(CImageSplitter& Splitter, const CProgramOptions& Options);
};

class CWordExport
{
protected:
	static void ExportIthPieceToWord(CImageSplitter& Splitter, CWordProxy& Word, int i);
public:
	static void ExportToWord(CImageSplitter& Splitter, const tstring& OutputFile); 
};

class CFileExport: public CBaseExport
{
public:
	static void ExportToFile(CImageSplitter &Splitter, const tstring& OutputFile, const SIZE& PieceSize, const tstring& OutputFilePattern, int MaxOutputFileLen); 
};